Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(storage-provider-server): add deal validations & market account check #614

Merged
merged 3 commits into from
Nov 27, 2024

Conversation

jmg-duarte
Copy link
Collaborator

Description

  • Updates the .gitignore because the params getting checked in was annoying
  • Adds deal validations
  • Checks if the SP has a valid mkt account

Demo (aka apologies for lacking tests but adding the framework now would be too much):

jmgd@parthenon:~/polka-storage$ ./examples/rpc_publish.sh examples/random1024.piece 
bafkreidvyofebclo4kny43vpoe5kejg3mqtpq2eemaojzyvlwikwdvusxy
Error: RpcClient(Call(ErrorObject { code: InvalidParams, message: "Piece size cannot be larger than the registered sector size", data: None }))

jmgd@parthenon:~/polka-storage$ ./examples/rpc_publish.sh examples/random1024.piece 
bafkreidvyofebclo4kny43vpoe5kejg3mqtpq2eemaojzyvlwikwdvusxy
Error: RpcClient(Call(ErrorObject { code: InvalidParams, message: "invalid piece_size, must be a power of two", data: None }))

jmgd@parthenon:~/polka-storage$ ./examples/rpc_publish.sh examples/random1024.piece 
bafkreidvyofebclo4kny43vpoe5kejg3mqtpq2eemaojzyvlwikwdvusxy
Error: RpcClient(Call(ErrorObject { code: InvalidParams, message: "piece_cid is not a piece commitment", data: None }))

jmgd@parthenon:~/polka-storage$ ./examples/rpc_publish.sh examples/random1024.piece 
bafkreidvyofebclo4kny43vpoe5kejg3mqtpq2eemaojzyvlwikwdvusxy
Error: RpcClient(Call(ErrorObject { code: InvalidParams, message: "storage_price_per_block must be superior to 0", data: None }))

jmgd@parthenon:~/polka-storage$ ./examples/rpc_publish.sh examples/random1024.piece 
bafkreidvyofebclo4kny43vpoe5kejg3mqtpq2eemaojzyvlwikwdvusxy
Error: RpcClient(Call(ErrorObject { code: InvalidParams, message: "start_block cannot be after end_block", data: None }))

jmgd@parthenon:~/polka-storage$ ./examples/rpc_publish.sh examples/random1024.piece 
bafkreidvyofebclo4kny43vpoe5kejg3mqtpq2eemaojzyvlwikwdvusxy
Error: RpcClient(Call(ErrorObject { code: InvalidParams, message: "client's balance is lower than the deal's cost", data: None }))

jmgd@parthenon:~/polka-storage$ ./examples/rpc_publish.sh examples/random1024.piece 
bafkreidvyofebclo4kny43vpoe5kejg3mqtpq2eemaojzyvlwikwdvusxy
Error: RpcClient(Call(ErrorObject { code: InvalidParams, message: "storage provider balance is lower than the deal's collateral", data: None }))

jmgd@parthenon:~/polka-storage$ ./examples/rpc_publish.sh examples/random1024.piece 
bafkreidvyofebclo4kny43vpoe5kejg3mqtpq2eemaojzyvlwikwdvusxy
Error: RpcClient(Call(ErrorObject { code: InvalidParams, message: "deal's provider ID does not match the current provider ID", data: None }))

Checklist

  • Make sure that you described what this change does.
  • Have you tested this solution?
  • Did you document new (or modified) APIs?

@jmg-duarte jmg-duarte self-assigned this Nov 26, 2024
@jmg-duarte jmg-duarte added enhancement New feature or request ready for review Review is needed labels Nov 26, 2024
@jmg-duarte jmg-duarte added this to the Phase 3 milestone Nov 26, 2024
@jmg-duarte jmg-duarte added ready for review Review is needed and removed ready for review Review is needed labels Nov 26, 2024
@th7nder th7nder added ready for review Review is needed and removed ready for review Review is needed labels Nov 26, 2024
@jmg-duarte jmg-duarte enabled auto-merge (squash) November 26, 2024 19:24
@jmg-duarte jmg-duarte merged commit d46136b into develop Nov 27, 2024
5 checks passed
@jmg-duarte jmg-duarte deleted the fix/no-ref/validations branch November 27, 2024 05:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ready for review Review is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants